package cn.bkrc.RedisTest;

import cn.bkrc.redis.RedisSetUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Set;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class SetTest {
    @Autowired
    RedisSetUtils redisSetUtil;

    @Test
    public void add(){
        redisSetUtil.add("countries","usa","china");
    }

    @Test
    public void members(){
        Set<Object> countries=redisSetUtil.members("countries");
        for(Object O:countries){
            System.out.println(O);
        }
    }

    @Test
    public void remove(){
        redisSetUtil.remove("countries","china");
    }
}
